<template>
	<view>
		<view class="item" @click="clickto(pro.id)">
			<image class="item_pic" :src="pro.img" mode=""></image>
			<view class="ms">
				<view class="name">
					{{pro.name}}
				</view>
				<view class="price">
					<view class="xprice">
						<image v-if="pro.type=='1'" class="qian_icon" src="/static/img/home/qian_icon.png" mode=""></image>
						<image v-if="pro.type=='3'" class="qian_icon1" src="/static/img/proitem/jf.png" mode=""></image>
						<image v-if="pro.type=='2'" class="qian_icon1" src="/static/img/proitem/tz.png" mode=""></image>
						<view class="xprcnum">
							{{pro.price}}
						</view>
					</view>
					<view class="yprice" v-if="pro.oldprice">
						{{pro.oldprice}}
					</view>
				</view>
				<view class="tips">
					<view class="tips_item">
						库存{{pro.num}}件
					</view>
					<view class="tips_item" v-if="pro.monethnum">
						月销{{pro.monethnum}}件
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "proitem",
		props:{
			pro: {
			    type: Object,
			    default() {
			        return {
						
					};
			    }
			},
			tab:{
				type:String,
				default(){
					return 'no'
				}
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			clickto(id){
				uni.$u.route('/pages/product/prodetail', { id: id ,type:this.tab});
			},
			
		}
	}
</script>

<style lang="less">
	.item {
		width: 344rpx;
		margin-bottom: 17rpx;
		.item_pic {
			width: 344rpx;
			height: 344rpx;
			border-radius: 15rpx 15rpx 0px 0px;
		}

		.ms {
			width: 346rpx;
			background: #FFFFFF;
			border-radius: 0px 0px 15rpx 15rpx;
			padding: 20rpx 0;
			margin-top: -3px;
			.name{
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #181818;
				padding-left: 20rpx;
			}
			.price{
				display: flex;
				align-items: center;
				padding-left: 20rpx;
				margin-top: 20rpx;
				.xprice{
					display: flex;
					align-items: center;
					.qian_icon{
						width: 20rpx;
						height: 24rpx;
					}
					.qian_icon1{
						width: 22rpx;
						height: 22rpx;
						margin-right: 7rpx;
					}
					.xprcnum{
						color: #FD2A00;
						font-size: 34rpx;
						font-weight: bold;
					}
				}
				.yprice{
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: bold;
					text-decoration: line-through;
					color: #919191;
					margin-left: 10rpx;
				}
			}
			.tips{
				display: flex;
				margin-top: 13rpx;
				margin-left: 19rpx;
				.tips_item{
					line-height: 30rpx;
					border: 2rpx solid #D9D9D9;
					border-radius: 5rpx;
					padding: 0 8rpx;
					color: #6A6A6A;
					font-size: 19rpx;
					font-weight: bold;
					margin-right: 6rpx;
				}
			}
		}
	}
</style>
